"""
练习 文件操作综合案例
"""

file_path = "/Users/dongjian/Documents/dev_file/bill.txt"
new_path = "/Users/dongjian/Documents/dev_file/bill.txt.bak"
# 打开文件 open r
fr = open(file_path, "r", encoding="UTF-8")
# 打开/创建备份文件
fw = open(new_path, "w", encoding="UTF-8")

for line in fr:
    line = line.strip()
    remark = line.split(" ")[4]
    if remark == "测试":
        continue
    fw.write(line)
    fw.write("\n")

# close
fr.close()
fw.close()
